load("@rules_license//rules:license.bzl", "license")

package(
    default_applicable_licenses = [":license"],
)

# NOTE: Octomap has a BSD license, but octovis, which is *not* included in this
# BUILD file, has a GPL license.
license(
    name = "license",
    package_name = "octomap",
    license_kinds = ["@rules_license//licenses/spdx:BSD-3-Clause"],
    license_text = ":octomap/LICENSE.txt",
)

octomap_sources = glob(
    include = [
        "octomap/src/**/*.cpp",
    ],
    exclude = [
        "octomap/src/binvox2bt.cpp",
        "octomap/src/bt2vrml.cpp",
        "octomap/src/compare_octrees.cpp",
        "octomap/src/convert_octree.cpp",
        "octomap/src/edit_octree.cpp",
        "octomap/src/eval_octree_accuracy.cpp",
        "octomap/src/graph2tree.cpp",
        "octomap/src/intersection_example.cpp",
        "octomap/src/log2graph.cpp",
        "octomap/src/normals_example.cpp",
        "octomap/src/octree2pointcloud.cpp",
        "octomap/src/offset_graph.cpp",
        "octomap/src/simple_example.cpp",
        "octomap/src/testing/*",
    ],
)

octomap_headers = glob(
    include = [
        "octomap/include/**/*.h*",
    ],
)

cc_library(
    name = "octomap",
    srcs = octomap_sources,
    hdrs = octomap_headers,
    includes = [
        "octomap/include",
    ],
    visibility = ["//visibility:public"],
)
